"data": "Sub CenterForm (Frm As Form)\r\n'-- Places a form in the middle of the screen\r\n \r\n Frm.Left = (Screen.Width - Frm.Width) \\ 2\r\n Frm.Top = (Screen.Height - Frm.Height) \\ 2\r\n\r\nEnd Sub\r\n"
},
{
"ID": "Restartwin()",
"Desc": "Restarts windows",
"data": "'REM ** How To Restart Windows **\r\n'REM ** Place API below in MODULE **\r\n\r\nDeclare Function ExitWindows% Lib \"User\" (ByVal dwReserved&, ByVal wReturnCode%)\r\nx% = ExitWindows(66, 66)"
},
{
"ID": "Shell to dos",
"Desc": "Shell to dos from vb",
"data": "Function ToShellToDos (commandline As String) As Long\r\n\r\nRem ** Routine To Shell To Dos And Stay In This Routine Until Task Is Complete **\r\n s% = Shell(commandline$) 'shells out with the command in commandline$\r\n While GetModuleUsage(s%) 'checks to see if finished\r\n x% = DoEvents() 'allows it to continue if unfinished.\r\n Wend\r\n ToShellToDos = s% 'returns task ID or error code from function.\r\nEnd Function"
},
{
"ID": "helptoc()",
"Desc": "loads the winhelp table of contents",
"data": "Dim temp As Integer\r\n\r\nDim HelpFile As String\r\n\r\n\r\nHelpFile = app.Path & \"\\Hwin.hlp\"\r\ntemp = WinHelp(Main.hWnd, HelpFile, &H3, \" \")\r\n"
},
{
"ID": "searchhelp()",
"Desc": "search for help on",
"data": "Sub Hsearch_Click ()\r\nDim DummyVal As String\r\nDim temp As Integer\r\nDim HelpFile As String\r\n\r\nHelpFile = app.Path & \"\\Hwin.hlp\"\r\nDummyVal = \" \"\r\ntemp% = WinHelp(Main.hWnd, HelpFile, &H105, DummyVal$)\r\n\r\nEnd Sub\r\n"
},
{
"ID": "helponHelp()",
"Desc": "loads windows help",
"data": "Dim temp As Integer\r\nDim dummy As String\r\nDim HelpFile As String\r\n\r\nHelpFile = \"winhelp.hlp\"\r\ntemp = WinHelp(Main.hWnd, HelpFile, &H4, \" \")\r\n"
},
{
"ID": "MakeTopmost",
"Desc": "Makes a window the topmost window (floating)",
"data": "Declare Function SetWindowPos Lib \"user\" (ByVal h%, ByVal hb%,\r\n ByVal x%, ByVal y%, ByVal cx%, ByVal cy%, ByVal f%) As Integer\r\n' The above Declare statement must appear on one line.\r\n\r\nGlobal Const SWP_NOMOVE = 2\r\nGlobal Const SWP_NOSIZE = 1\r\nGlobal Const FLAGS = SWP_NOMOVE Or SWP_NOSIZE\r\nGlobal Const HWND_TOPMOST = -1\r\nGlobal Const HWND_NOTOPMOST = -2\r\n\r\n\r\n'this lines goes in the formload\r\nsuccess% = SetWindowPos (FORMNAME.hWnd, HWND_TOPMOST, 0, 0, 0, 0, FLAGS)\r\nREM success% <> 0 When Successful\r\n"
},
{
"ID": "setpreinst()",
"Desc": "Sets to pre instance when another is started",
"data": " Declare Function FindWindow% Lib \"user\" (ByVal lpClassName As Any,\r\n ByVal lpCaption As Any)\r\n Declare Function ShowWindow% Lib \"User\" (ByVal Handle As Integer,\r\n ByVal Cmd As Integer)\r\n Declare Function SFocus% Lib \"User\" Alias \"SetFocus\" (ByVal Handle As\r\n Integer)\r\n\r\n'4. Put the following code in the Form1.Load event:\r\n\r\n Title$ = \"Test Program\"\r\n X% = CheckUnique(Title$)\r\n If X% = 0 Then\r\n End\r\n End If\r\n Form1.Caption= Title$\r\n\r\n'5. Create the following general function:\r\n\r\n\r\n Function CheckUnique (FormName As String) As Integer\r\n Dim Handle As Integer\r\n Handle = FindWindow(0&, FormName)\r\n\r\n If Handle = 0 Then\r\n ' -1 is a true value.\r\n CheckUnique = -1\r\n Else\r\n X% = ShowWindow(Handle, 1)\r\n X% = SFocus(Handle)\r\n ' 0 is a false value.\r\n CheckUnique = 0\r\n End If\r\n End Function\r\n"
},
{
"ID": "butcall()",
"Desc": "code for inside the place call button",
"data": " PhoneNum$ = Text3.Text '-- Phone number\r\n If Len(PhoneNum$) = 0 Then\r\n Beep\r\n StatusPrint \"You must enter a phone number\"\r\n Exit Sub\r\n End If\r\n\r\n Attempts = Val(Text2.Text) '-- Number of attempts\r\n Timeout = 45 '-- Wait up to 45 seconds\r\n\r\n'----------------------------------------------------------------\r\n \r\n cmdPlaceCall.Enabled = False\r\n\r\n '-- Place the call\r\n Call PlaceCall(Comm1, PhoneNum$, Attempts, Timeout, Result, ModemBaud&, RealBaud&, Mode$)\r\n\r\n cmdPlaceCall.Enabled = True\r\n\r\n '-- What happenned?\r\n Select Case MWError()\r\n Case MW_PLACECALL_OK\r\n '-- PlaceCall returned a valid result code. Check Result\r\n Select Case Result\r\n Case MW_RESULT_CONNECT '-- CONNECT\r\n Msg$ = \"Connected at \" & Format$(ModemBaud&)\r\n If Len(Mode$) Then\r\n Msg$ = Msg$ & \" using \" & Mode$\r\n End If\r\n Case MW_RESULT_BUSY '-- BUSY\r\n Msg$ = \"The line is busy. Try again later\"\r\n Case MW_RESULT_NO_DIALTONE '-- NO DIALTONE\r\n Msg$ = \"There is no dialtone. Check connections and try again\"\r\n Case MW_RESULT_NO_CARRIER '-- NO CARRIER\r\n Msg$ = \"The other modem did not respond\"\r\n Case MW_RESULT_TIMEOUT '-- TIMEOUT\r\n Msg$ = \"The other modem did not respond\"\r\n Case Else\r\n Msg$ = Result2Str$(Comm1, Result)\r\n End Select\r\n Case Else\r\n Msg$ = MWErrorMsg$()\r\n End Select\r\n\r\n Beep\r\n StatusPrint Msg$\r\n"
},
{
"ID": "Hostmode",
"Desc": "code for go to host mode button",
"data": "\r\n NumRings = Val(Text4.Text)\r\n If NumRings = 0 Then NumRings = 1\r\n\r\n'--------------------------------------------\r\n\r\n cmdWaitForCall.Enabled = False\r\n\r\n '-- Wait for a call\r\n Call WaitForCall(Comm1, NumRings, ModemBaud&, RealBaud&, Mode$)\r\n\r\n cmdWaitForCall.Enabled = True\r\n \r\n Select Case MWError()\r\n Case MW_WAITFORCALL_OK\r\n '-- Connected\r\n Msg$ = \"Connected at \" & Format$(ModemBaud&)\r\n If Len(Mode$) Then\r\n Msg$ = Msg$ & \" using \" & Mode$\r\n End If\r\n Case Else\r\n Msg$ = MWErrorMsg$()\r\n End Select\r\n \r\n Beep\r\n StatusPrint Msg$\r\n"
},
{
"ID": "sendcommand()",
"Desc": "code for send commands to modem button",
"data": "\r\n Cmd$ = Text5.Text\r\n Attempts = 2 '-- Standard (1 retry)\r\n Timeout = 10 '-- Normally you shouldn't need more than 10 seconds\r\n \r\n'-------------------------------------------------------------------------------\r\n\r\n '-- Send the command to the modem\r\n Call SendModemCmd(Comm1, Cmd$, Attempts, Timeout, Result)\r\n\r\n '-- What happenned?\r\n Select Case MWError()\r\n Case MW_SENDMODEMCMD_OK\r\n Msg$ = \"Modem Responded: \" & Result2Str$(Comm1, Result)\r\n Case Else\r\n Msg$ = MWErrorMsg$()\r\n End Select\r\n\r\n Beep\r\n StatusPrint Msg$\r\n"
"data": "Sub sleep (waittime As Single)\r\n\r\nDim starttime As Single\r\nDim dummy\r\n\r\n starttime = Timer\r\n Do While Timer < (starttime + waittime)\r\n dummy = DoEvents()\r\n Loop\r\nEnd Sub\r\n"
},
{
"ID": "decl printerstruc",
"Desc": "declrations for landscape mode on ptr",
"data": "Type OrientStructure\r\n Orientation As Long\r\n Pad As String * 16\r\n End Type\r\n ' Enter the following Declare statement on one, single line:\r\n Declare Function Escape% Lib \"GDI\" (ByVal hDc%, ByVal nEsc%, ByVal nLen%, lpData As OrientStructure, lpOut As Any)"
},
{
"ID": "landscape exec",
"Desc": "puts printer into landscape mode",
"data": "Orient.Orientation = 2\r\n\r\n '* Send escape sequence to change orientation\r\n x% = Escape(Printer.hDC, GETSETPAPERORIENT,\r\n Len(Orient), Orient, NULL)\r\n '* The EndDoc will now re-initialize the printer\r\n Printer.EndDoc\r\n"